package com.jbm.jbmsupplier.util;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;

/**
 * Created by lyh on 2017-03-15.
 */
////@Entity
////@Table(name = "voucher", schema = "", catalog = "jbmcore")
////@org.hibernate.annotations.Entity(dynamicUpdate=true,dynamicInsert=true)
public class VoucherEntity extends  ICtrl  implements Serializable {
    private static final long serialVersionUID = 1491624307952979505L;
    private int voucherId;
    private Integer loginId;
    private String voucherCode;  //16位码
    private Integer voucherType;  //代金券种类 枚举VoucherType
    private Integer amount;  //价值金额
    private Integer source;    //代金券来源 枚举VoucherSourceType
    private Timestamp createDate; //创建日期
    private Date expireDate;  //失效日期
    private Integer targetId;  // 目标id 若用于报修则为 订单id
    private Integer targetType; // 目标类型 枚举VoucherTargetType
    private Integer status; //状态 1有效 0失效
    private String memo;   //代金券名字
    private String ext1;   //扩展字段 暂时未用
    private String ext2;   //扩展字段 暂时未用
    private String picpath;   //图片地址
    private Integer platformRatio;

    public  VoucherEntity(){}
    public  VoucherEntity(String method,int voucherId,String voucherCode,Integer loginId,Integer voucherType,Integer source,Integer targetId,Integer targetType,Integer status,int start,int pagesize){
        this.method=method;
        this.voucherId=voucherId;
        this.voucherCode=voucherCode;
        this.loginId=loginId;
        this.voucherType=  voucherType;
        this.source=source;
        this.targetId=targetId;
        this.targetType=targetType;
        this.status=status;
           this.start=start;
        this.pagesize=pagesize;

    }
    public  VoucherEntity(boolean back,String errorinfo){
        this.back=back;
        this.errorinfo=errorinfo;
    }

    public void setExpireDate(java.sql.Date expireDate) {
        this.expireDate = expireDate;
    }

    ////@Id
    ////@Column(name = "voucher_id")
    ////@GeneratedValue
    public int getVoucherId() {
        return voucherId;
    }

    public void setVoucherId(int voucherId) {
        this.voucherId = voucherId;
    }

    ////@Basic
    ////@Column(name = "login_id")
    public Integer getLoginId() {
        return loginId;
    }

    public void setLoginId(Integer loginId) {
        this.loginId = loginId;
    }

    ////@Basic
    ////@Column(name = "voucher_code")
    public String getVoucherCode() {
        return voucherCode;
    }

    public void setVoucherCode(String voucherCode) {
        this.voucherCode = voucherCode;
    }

    ////@Basic
    ////@Column(name = "voucher_type")
    public Integer getVoucherType() {
        return voucherType;
    }

    public void setVoucherType(Integer voucherType) {
        this.voucherType = voucherType;
    }

    ////@Basic
    ////@Column(name = "amount")
    public Integer getAmount() {
        return amount;
    }

    public void setAmount(Integer amount) {
        this.amount = amount;
    }

    ////@Basic
    ////@Column(name = "source")
    public Integer getSource() {
        return source;
    }

    public void setSource(Integer source) {
        this.source = source;
    }

    ////@Basic
    ////@Column(name = "create_date")
    public Timestamp getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Timestamp createDate) {
        this.createDate = createDate;
    }

    ////@Basic
    ////@Column(name = "expire_date")
    public Date getExpireDate() {
        return expireDate;
    }

    public void setExpireDate(Date expireDate) {
        this.expireDate = expireDate;
    }

    ////@Basic
    ////@Column(name = "target_id")
    public Integer getTargetId() {
        return targetId;
    }

    public void setTargetId(Integer targetId) {
        this.targetId = targetId;
    }

    ////@Basic
    ////@Column(name = "target_type")
    public Integer getTargetType() {
        return targetType;
    }

    public void setTargetType(Integer targetType) {
        this.targetType = targetType;
    }

    ////@Basic
    ////@Column(name = "status")
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    ////@Basic
    ////@Column(name = "memo")
    public String getMemo() {
        return memo;
    }

    public void setMemo(String memo) {
        this.memo = memo;
    }

    ////@Basic
    ////@Column(name = "ext1")
    public String getExt1() {
        return ext1;
    }

    public void setExt1(String ext1) {
        this.ext1 = ext1;
    }

    ////@Basic
    ////@Column(name = "ext2")
    public String getExt2() {
        return ext2;
    }

    public void setExt2(String ext2) {
        this.ext2 = ext2;
    }

    ////@Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        VoucherEntity that = (VoucherEntity) o;

        if (voucherId != that.voucherId) return false;
        if (amount != null ? !amount.equals(that.amount) : that.amount != null) return false;
        if (createDate != null ? !createDate.equals(that.createDate) : that.createDate != null) return false;
        if (expireDate != null ? !expireDate.equals(that.expireDate) : that.expireDate != null) return false;
        if (ext1 != null ? !ext1.equals(that.ext1) : that.ext1 != null) return false;
        if (ext2 != null ? !ext2.equals(that.ext2) : that.ext2 != null) return false;
        if (loginId != null ? !loginId.equals(that.loginId) : that.loginId != null) return false;
        if (memo != null ? !memo.equals(that.memo) : that.memo != null) return false;
        if (source != null ? !source.equals(that.source) : that.source != null) return false;
        if (status != null ? !status.equals(that.status) : that.status != null) return false;
        if (targetId != null ? !targetId.equals(that.targetId) : that.targetId != null) return false;
        if (targetType != null ? !targetType.equals(that.targetType) : that.targetType != null) return false;
        if (voucherCode != null ? !voucherCode.equals(that.voucherCode) : that.voucherCode != null) return false;
        if (voucherType != null ? !voucherType.equals(that.voucherType) : that.voucherType != null) return false;

        return true;
    }

    ////@Override
    public int hashCode() {
        int result = voucherId;
        result = 31 * result + (loginId != null ? loginId.hashCode() : 0);
        result = 31 * result + (voucherCode != null ? voucherCode.hashCode() : 0);
        result = 31 * result + (voucherType != null ? voucherType.hashCode() : 0);
        result = 31 * result + (amount != null ? amount.hashCode() : 0);
        result = 31 * result + (source != null ? source.hashCode() : 0);
        result = 31 * result + (createDate != null ? createDate.hashCode() : 0);
        result = 31 * result + (expireDate != null ? expireDate.hashCode() : 0);
        result = 31 * result + (targetId != null ? targetId.hashCode() : 0);
        result = 31 * result + (targetType != null ? targetType.hashCode() : 0);
        result = 31 * result + (status != null ? status.hashCode() : 0);
        result = 31 * result + (memo != null ? memo.hashCode() : 0);
        result = 31 * result + (ext1 != null ? ext1.hashCode() : 0);
        result = 31 * result + (ext2 != null ? ext2.hashCode() : 0);
        return result;
    }

    ////@Basic
    ////@Column(name = "picpath")
    public String getPicpath() {
        return picpath;
    }

    public void setPicpath(String picpath) {
        this.picpath = picpath;
    }

    ////@Basic
    ////@Column(name = "platform_Ratio")
    public Integer getPlatformRatio() {
        return platformRatio;
    }

    public void setPlatformRatio(Integer platformRatio) {
        this.platformRatio = platformRatio;
    }
}
